<template>
  <a-layout>
    <a-layout-header class="header">
      <a-menu
        v-model:selectedKeys="selectedKeys1"
        theme="dark"
        mode="horizontal"
        :style="{ lineHeight: '64px' }"
      >
        <a-menu-item key="1">
          <router-link to="/shouye"> 首页 </router-link>
        </a-menu-item>
        <a-menu-item key="2">
          <router-link to="/fenlei">文章分类 </router-link>
        </a-menu-item>
        <a-menu-item key="3">
          <router-link to="/biaoqian"> 标签 </router-link>
        </a-menu-item>
        <a-menu-item key="4">
          <router-link to="/fabu"> 发布 </router-link>
        </a-menu-item>
        <a-menu-item key="5" class="yidong">
          <router-link to="/login">登录</router-link>
        </a-menu-item>
        <a-menu-item key="6">
          <router-link to="/register">注册</router-link>
        </a-menu-item>
      </a-menu>
    </a-layout-header>
    <a-layout>
      <a-layout-sider width="200" style="background: #fff">
        <a-menu
          v-model:selectedKeys="selectedKeys2"
          v-model:openKeys="openKeys"
          mode="inline"
          :style="{ height: '100%', borderRight: 0 }"
        >
          <a-sub-menu key="sub1">
            <template #title>
              <span>
                <user-outlined />
                分类列表
              </span>
            </template>
            <a-menu-item key="1">
              <router-link to="/jishuzhan"> 技术栈 </router-link>
            </a-menu-item>
            <a-menu-item key="2">
              <router-link to="/duanwen"> 精品短文 </router-link>
            </a-menu-item>
            <a-menu-item key="3">
              <router-link to="/hotpage"> 热门文章 </router-link>
            </a-menu-item>
          </a-sub-menu>
          <a-sub-menu key="sub2">
            <template #title>
              <span>
                <laptop-outlined />
                更多
              </span>
            </template>
            <a-menu-item key="5">
              <router-link to="/fenxi"> 数据分析 </router-link>
            </a-menu-item>
            <a-menu-item key="6">
              <router-link to="/newping"> 评论审查 </router-link>
            </a-menu-item>
            <a-menu-item key="7">
              <router-link to="/history"> 浏览历史 </router-link>
            </a-menu-item>
            <a-menu-item key="8">
              <router-link to="/huishou"> 回收站 </router-link>
            </a-menu-item>
          </a-sub-menu>
          <a-sub-menu key="sub3">
            <template #title>
              <span>
                <notification-outlined />
                关于作者
              </span>
            </template>
            <a-menu-item key="9">个人简介</a-menu-item>
            <a-menu-item key="10">联系方式</a-menu-item>
            <a-menu-item key="11">友情链接</a-menu-item>
            <a-menu-item key="12">
              <router-link to="/lixiang"> 立项要求 </router-link>
            </a-menu-item>
          </a-sub-menu>
        </a-menu>
      </a-layout-sider>
      <a-layout style="padding: 0 24px 24px">
        <a-breadcrumb style="margin: 16px 0">
          <a-breadcrumb-item>
            <router-link to="/shouye">首页</router-link>
          </a-breadcrumb-item>
          <a-breadcrumb-item>
            {{ breadcrumbNameMap[$route.path] }}
          </a-breadcrumb-item>
        </a-breadcrumb>
        <a-layout-content
          :style="{
            background: '#fff',
            padding: '24px',
            margin: 0,
            minHeight: '280px',
          }"
        >
          <router-view />
        </a-layout-content>
      </a-layout>
    </a-layout>
    <Footer class="main" />
  </a-layout>
</template>
<script setup>
import { ref, computed } from "vue";
import Footer from "../components/footer.vue";

const selectedKeys1 = ref(["1"]);
const selectedKeys2 = ref(["2"]);
const collapsed = ref(false);
const openKeys = ref(["sub1"]);

// 定义面包屑
const breadcrumbNameMap = {
  "/shouye": "首页",
  "/fenlei": "文章分类",
  "/biaoqian": "标签",
  "/fabu": "发布",
  "/login": "登录",
  "/register": "注册",
  "/lixiang": "立项要求",
};

const currentBreadcrumb = computed(() => breadcrumbNameMap[$route.path]);
</script>
<style>
.yidong {
  margin-left: 900px;
}

#components-layout-demo-top-side-2 .logo {
  float: left;
  width: 120px;
  height: 31px;
  margin: 16px 24px 16px 0;
  background: rgba(255, 255, 255, 0.3);
}

.ant-row-rtl #components-layout-demo-top-side-2 .logo {
  float: right;
  margin: 16px 0 16px 24px;
}

.site-layout-background {
  background: #fff;
}

.main {
  margin: 0 auto;
  /* 固定底部 */
}
</style>
